package cn.tianjindong.blog.pojo;

import java.text.SimpleDateFormat;
import java.util.Date;

public class BlogNotice {
    private Long id;

    private String title;

    private Integer tab;//表示当前公告是否有效。1表示有效，0表示无效

    private Long managerId;

    private Date createTime;

    private Date updateTime;

    private Integer level;

    private String content;
    
    private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    private static SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public Integer getTab() {
        return tab;
    }

    public void setTab(Integer tab) {
        this.tab = tab;
    }

    public Long getManagerId() {
        return managerId;
    }

    public void setManagerId(Long managerId) {
        this.managerId = managerId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }
    
	/**
	 * 获取标题的简要信息(超过15个字符的省略)
	 * @return
	 */
	public String getBriefTitle() {
		if (this.title.length() > 15) {
			return this.title.substring(0, 15) + "...";
		}
		return this.title;
	}
	
	/**
	 * 获取时间字符串
	 * @return
	 */
	public String getStringUpdatetime() {
		String dateStr = dateFormat.format(this.updateTime);
		return dateStr;
	}
	
	/**
	 * 获取日期字符串
	 * @return
	 */
	public String getBriefUpdatetime() {
		String dateStr = dateFormat2.format(this.updateTime);
		return dateStr;
	}
}